﻿<UserControl x:Class="Showroom.WP7.SampleLayouts"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:ViewModels="clr-namespace:Showroom.WP7" xmlns:my="clr-namespace:SStuff.FlowControls;assembly=SStuff.FlowControls" mc:Ignorable="d"
             xmlns:LayoutAlgorithms="clr-namespace:SStuff.LayoutAlgorithms;assembly=SStuff.LayoutAlgorithms" FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">
    <UserControl.Resources>
        <DataTemplate x:Key="itemTemplate">
            <Grid>
                <Ellipse Width="80"
                         Height="80"
                         Stroke="Black"
                         Fill="White" />
                <TextBlock Text="{Binding}"
                           Foreground="Black"
                           FontSize="10"
                           HorizontalAlignment="Center"
                           VerticalAlignment="Center" />
            </Grid>
        </DataTemplate>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" >
        <Grid.DataContext>
            <ViewModels:VirtualizationSampleData />
        </Grid.DataContext>
        <my:FlowItemsControl2D Name="flowItemsControl2D1"
                               ItemsSource="{Binding Path=Items}"
                               ItemTemplate="{StaticResource itemTemplate}">
            <my:FlowItemsControl2D.LayoutAlgorithm>
                <LayoutAlgorithms:Circular2DLayout />
            </my:FlowItemsControl2D.LayoutAlgorithm>
            <my:FlowItemsControl2D.Style>
                <Style TargetType="my:FlowItemsControl2D">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="my:FlowItemsControl2D">
                                <Border Background="{TemplateBinding Background}"
                                        BorderBrush="{TemplateBinding BorderBrush}"
                                        BorderThickness="{TemplateBinding BorderThickness}">
                                    <ItemsPresenter x:Name="ItemsPresenter" />
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="ItemsPanel">
                        <Setter.Value>
                            <ItemsPanelTemplate>
                                <my:FlowPanel2D />
                            </ItemsPanelTemplate>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="Background"
                            Value="Transparent" />
                </Style>
            </my:FlowItemsControl2D.Style>
            <my:FlowItemsControl2D.ItemContainerStyle>
                <Style TargetType="my:FlowItem2D">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="my:FlowItem2D">
                                <Grid>
                                   
                                    <ContentPresenter />
                                </Grid>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </my:FlowItemsControl2D.ItemContainerStyle>
        </my:FlowItemsControl2D>
    </Grid>
</UserControl>
